import {getVideoData, getVideoDataById, saveVideo, uploadVideoData} from "../service/video.js";
import {saveFile} from "../utils/file.js";

export async function uploadVideo(event, req, res){
    const {files, fields} = await saveVideo(req)
    for (const key in fields) {
        if (fields[key] instanceof Array){
            event[key] = fields[key][0]
        }else {
            event[key] = fields[key]
        }
    }
    const result = await uploadVideoData(event)
}

export async function getVideo(event, req, res){
    const videoData = await getVideoData()

    return videoData
}

export async function getVideoById(event, req, res){
    const videoData = getVideoDataById(req.query.videoId)

    return videoData
}
